Under the “COMPILER CONFIGURATION” sub-section, there is an

option for “Auto Compile”; if you set it on, it’s really helpful while

writing complex algorithms. If something goes wrong in the code, it

can indicate you immediately. You can also prefer to set it off and

compile it directly by clicking on the button. If there is an error, it

shows the line number and marks it in red. All the errors must be

fixed before moving on to the next stage.

Now, here you may find a couple of warnings marked in yellow if you

delete the first line, but that is fine. Unless we have errors, we can

ignore these warnings for the time being and go ahead with

deployment and running.

2.5.5.2 Deployment

Deploying a Solidity contract on REMIX is simple. We can just visit

the “DEPLOY AND RUNTRANSACTION” section and choose the

compiled contract to run.

Now, we have three different environments for deploying and testing

the contracts, which are as follows:

JavaScript VM (default)

Injected Web3

and Web3 Provider

Let’s keep the default one, i.e., JavaScript VM. Why?

It will run an isolated Ethereum node in the browser. It is very useful

when you want to test a contract. There are already a few Ethereum

accounts that are created and prepopulated with 100 Ethers each.

Now, we deploy.

You can find a Deployed Contracts section just below the Deploy

button. You can keep clicking on the deploy button again and again;

each time you will find a new version of the deployed contract. You

can also expand this section and delete the previous versions of the

deployed contracts to avoid confusion. Then, deploy again.

Now, you can expand the deployed contract and find a button in the

same name as the function that we wrote. You can click on the

button and find the desired output now.